package cn.tedu.spring.config;

import cn.tedu.spring.auto.UserCache;
import cn.tedu.spring.file.DatabaseConnect;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestSpring {
    public static void main(String[] args) {
        // 指定配置类：SpringConfig.class
        ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
        // 获取DabaseConnect的bean对象
        DatabaseConnect databaseConnect = context.getBean(DatabaseConnect.class);
        System.out.println(databaseConnect);

        // 获取UserCache的bean对象
        UserCache userCache = context.getBean(UserCache.class);
        System.out.println(userCache);
    }
}








